/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef PRESCALERS_H_
#define PRESCALERS_H_

#include "../Utils/CppExtensions.h"

namespace Timers
{

namespace Prescalers
{
	/*!
	 * Timer prescaler enum
	 * The timer's frequency will be \f$ \frac{freq_{clockSource}}{prescaler} \f$
	 * where \f$ freq_{clockSource} \f$ is typically the cpu frequency but can be provided externally
	 */
	enum Prescaler
	{
		STOP_TIMER_0 = 0x00,		//!< stops the timer

		DIV_1 = 0x01,			//!< divide clock source by 1

		DIV_8 = 0x02,			//!< divide clock source by 8

		DIV_NO_EXT_32 = 0x03,			//!< divide clock source by 32
		DIV_EXT_64 = 0x03,			//!< divide clock source by 64

		DIV_NO_EXT_64 = 0x04,			//!< divide clock source by 64
		DIV_EXT_256 = 0x04,			//!< divide clock source by 256

		DIV_NO_EXT_128 = 0x05,			//!< divide clock source by 128
		DIV_EXT_1024 = 0x05,			//!< divide clock source by 1024

		DIV_NO_EXT_256 = 0x06,			//!< divide clock source by 256
		EXT_FALLING = 0x06,			//!< clocksource from Tn pin falling edge

		DIV_NO_EXT_1024 = 0x07,			//!< divide clock source by 1024
		EXT_RISING = 0x07,			//!< clocksource from Tn pin rising edge

		FASTEST_1 = DIV_1,			//!< same as DIV_1
		SLOWEST_NO_EXT_1024 = DIV_NO_EXT_1024,		//!< same as DIV_1024
		SLOWEST_EXT_1024 = DIV_EXT_1024		//!< same as DIV_1024

	};

}
}

#endif /* PRESCALERS_H_ */
